package com.shop.shopserver.controller.user;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shop.shopcommon.result.Result;
import com.shop.shoppojo.entity.Comment;
import com.shop.shoppojo.entity.User;
import com.shop.shoppojo.vo.CommentVO;
import com.shop.shopserver.mapper.CommentMapper;
import com.shop.shopserver.service.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.shop.shopcommon.constant.MessageConstant.SUCCESS;


@RestController
@RequestMapping("/comment")
@Api(tags = "评论模块")
public class CommentController {
    @Autowired
    private CommentService commentService;


    /**
     * 查询评论
     * @param goodsId
     * @return
     */
    @GetMapping("/getComment")
    @ApiOperation(value = "查询评论")
    public Result<CommentVO> getComments(@RequestParam String goodsId){
        CommentVO commentVO = commentService.getCommentsByGoodsId(goodsId);
        return Result.success(commentVO,SUCCESS);
    }
}
